package top.kaoshanji.p1ch12b;

import top.kaoshanji.p1ch12a.IGamePlayer;

/**
 * 代码清单-p1ch12b-115页a：代练者
 * @author kaoshanji
 * ^_^
 * create time 2025/3/22 17:43
 */
public class GamePlayerProxy implements IGamePlayer {

    private IGamePlayer gamePlayer = null;

    // 通过构造函数传递要对谁进行代练
    public GamePlayerProxy(IGamePlayer gamePlayer) {
        this.gamePlayer = gamePlayer;
    }

    // 代练登录
    @Override
    public void login(String user, String password) {
        this.gamePlayer.login(user, password);
    }

    // 代练杀怪
    @Override
    public void killBoss() {
        System.out.println("...预处理...");
        this.gamePlayer.killBoss();
        System.out.println("...善后处理...");
    }

    // 代练升级
    @Override
    public void upgrade() {
        this.gamePlayer.upgrade();
    }
}
